package com.twu.biblioteca;

import com.twu.biblioteca.Command.MenuHandler;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Bibilioteca {

    private PrintWriter out;
    private Scanner scanner;
    private User loggedUser;

    public PrintWriter getOutputBuffter() {
        return out;
    }

    public Scanner getScanner() {
        return scanner;
    }

    public User getLoggedUser() {
        return loggedUser;
    }

    public void setLoggedUser(User user) {
        loggedUser = user;
    }

    public Bibilioteca(Scanner scanner, PrintWriter outputBuffer) {
        this.scanner = scanner;
        this.out = outputBuffer;
    }

    public void run() {
        showWelcomeMessage();
        showMenuOptions();
        MenuHandler menuHandler = new MenuHandler(this);
        menuHandler.selectMenu();
    }

    private void showWelcomeMessage() {
        out.println("Welcome");
    }

    private void showMenuOptions() {
        out.println("please select an option from the menu:");
        for (int i = 0; i < BibiliotecaModel.getMenuOptions().size(); i++) {
            out.println(Integer.toString(i + 1) + " " + BibiliotecaModel.getMenuOptions().get(i));
        }
        out.println("Enter -1 to exit");
    }


    public boolean isLogged() {
        if (loggedUser != null) return true;
        return false;

    }

}
















